package atguigu.jdbc;

import com.alibaba.druid.pool.DruidDataSource;

public class DruidConfig {

    public static DruidDataSource createDataSource() {  
        DruidDataSource dataSource = new DruidDataSource();  
        dataSource.setUrl("jdbc:mysql://localhost:3306/test3?useSSL=false&serverTimezone=UTC");
        dataSource.setUsername("root");
        dataSource.setPassword("root123");
//        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        // 设置其他连接池参数，如初始大小、最大活跃连接数等
        dataSource.setInitialSize(5);  
        dataSource.setMaxActive(10);  
        // ... 其他配置  
        return dataSource;  
    }  
}